import { getProfile } from '@/api/user.js'
export default {
  namespaced: true,
  state: {
    userInfo: {}
  },
  mutations: {
    mSetUserInfo (state, newUserInfo) {
      state.userInfo = newUserInfo
    }
  },
  actions: {
    async getProfile (context) {
      try {
        const res = await getProfile()
        // console.log('modules， getProfile', res)
        context.commit('mSetUserInfo', res.data.data)
      } catch (err) {
        console.log(err)
        throw new Error(err)
      }
    }
  }
}
